package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.DepGroup;
import com.dhcc.DRGsHosp.facade.dto.DepGroupDTO;

public class DepGroupAssembler {
	
	public static DepGroupDTO  toDTO(DepGroup  depGroup){
		if (depGroup == null) {
			return null;
		}
    	DepGroupDTO result  = new DepGroupDTO();
	    	result.setDepGroupCode (depGroup.getDepGroupCode());
     	    	result.setDepGroupDesc (depGroup.getDepGroupDesc());
     	    	result.setDepgroupLeader (depGroup.getDepgroupLeader());
     	    	result.setDepGroupPhone (depGroup.getDepGroupPhone());
     	    	result.setDepGroupOrder (depGroup.getDepGroupOrder());
     	    return result;
	 }
	
	public static List<DepGroupDTO>  toDTOs(Collection<DepGroup>  depGroups){
		if (depGroups == null) {
			return null;
		}
		List<DepGroupDTO> results = new ArrayList<DepGroupDTO>();
		for (DepGroup each : depGroups) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static DepGroup  toEntity(DepGroupDTO  depGroupDTO){
	 	if (depGroupDTO == null) {
			return null;
		}
	 	DepGroup result  = new DepGroup();
        result.setDepGroupCode (depGroupDTO.getDepGroupCode());
         result.setDepGroupDesc (depGroupDTO.getDepGroupDesc());
         result.setDepgroupLeader (depGroupDTO.getDepgroupLeader());
         result.setDepGroupPhone (depGroupDTO.getDepGroupPhone());
         result.setDepGroupOrder (depGroupDTO.getDepGroupOrder());
 	  	return result;
	 }
	
	public static List<DepGroup> toEntities(Collection<DepGroupDTO> depGroupDTOs) {
		if (depGroupDTOs == null) {
			return null;
		}
		
		List<DepGroup> results = new ArrayList<DepGroup>();
		for (DepGroupDTO each : depGroupDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
